import Mysql from 'node-mysql-promise'

const mysqlPromise = Mysql.createConnection({
  host: '127.0.0.1',
  port: 3306,
  user: 'keke',
  password: '123123',
  database: 'main',
  logSql: true,
  charset: 'utf8mb4',
})

export { CONF_DEFINE_PAGE, CONF_DEFINE_PAGESIZE } from '../../utils/config'

export const useTable = (tableName: string) => mysqlPromise.table(tableName)

export const useQuery = (sql: string, parse: any) =>
  mysqlPromise.query(sql, parse)
